package com.spr.servlet.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.ui.ModelMap;
import com.spr.servlet.model.ItemObject;
import com.spr.servlet.model.SignedRequestsHelper;
@Controller
public class ItemController {

   @RequestMapping(value = "/", method = RequestMethod.GET)
   public ModelAndView item() {
      return new ModelAndView("index", "command", new ItemObject());
   }
   
   @RequestMapping(value = "/add", method = RequestMethod.POST)
   public String addItem(@ModelAttribute("SpringWeb")ItemObject itemobject, 
   ModelMap model) {
      model.addAttribute("id", itemobject.getItemID());
      model.addAttribute("title", itemobject.getTitle());
      model.addAttribute("desc", itemobject.getDesc());
      model.addAttribute("price",itemobject.getVariesPrice());
      return "show";
   }
}
